package com.softa.service.system.impl;

import com.github.pagehelper.ISelect;
import com.github.pagehelper.PageInfo;
import com.softa.annotation.ServiceLog;
import com.softa.bean.DataGridModel;
import com.softa.bean.JsonRes;
import com.softa.dao.dto.SysUserDTO;
import com.softa.dao.mapper.base.SysUserMapper;
import com.softa.dao.mapper.relation.system.SysFileRelationMapper;
import com.softa.dao.mapper.relation.system.SysUserRelationMapper;
import com.softa.dao.model.SysFile;
import com.softa.dao.model.SysResource;
import com.softa.dao.model.SysRole;
import com.softa.dao.model.SysUser;
import com.softa.enummodel.FileTypeEnum;
import com.softa.service.encrypt.PasswordHelper;
import com.softa.service.system.CustomUserCenterService;
import com.softa.service.system.RoleService;
import com.softa.service.system.SysFileService;
import com.softa.service.system.UserService;
import com.softa.utils.CommonUtil;
import com.softa.utils.Constants;
import com.softa.utils.DateUtils;
import com.softa.utils.FileUtil;
import com.softa.vo.DataGridRequest;
import com.softa.vo.QueryRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.util.*;

/**
 * 
* @ClassName: UserServiceImpl
* @Description: TODO
* @author yangl
*
 */
@SuppressWarnings("all")
@Service
public class CustomUserCenterServiceImpl implements CustomUserCenterService {

    @Autowired
    private SysFileService sysFileService;

    @Override
    public Model getPic(Model model, SysUser user) {
        QueryRequest queryRequest = new QueryRequest();
        queryRequest.getParams().put("pkeyId", user.getId().toString());
        queryRequest.getParams().put("tableName", SysUser.class.getSimpleName());
        queryRequest.getParams().put("fileType", FileTypeEnum.IMAGE.toString());
        SysFile sysFile = sysFileService.selectOneByCondition(queryRequest);
        if (null != sysFile) {
            model.addAttribute("pic", sysFile.getId());
        }
        return model;
    }
}
